<template>
	<view>
		<view class="call" @click="call_phone">公司电话：{{ phone }}</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			phone: ''
		};
	},
	async onLoad() {
		let res = await this.$api.config();
		if(res.code == 1){
			this.phone = res.data.website.tel;
		}
	},
	methods: {
		call_phone() {
			uni.makePhoneCall({
				// 手机号
				phoneNumber: this.phone+'',
				// 成功回调
				success: (res) => {
					console.log('调用成功!');
				},
				// 失败回调
				fail: (res) => {
					console.log(res)
					console.log('调用失败!');
				}
			});
		}
	}
};
</script>

<style scoped lang="less">
.call {
	margin: 40rpx 20rpx;
	font-size: 30rpx;
	font-family: PingFang SC;
	font-weight: bold;
	color: #000000;
	background: #fff;
	border: 2rpx solid #dedede;
	border-radius: 50rpx;
	padding: 30rpx 38rpx;
}
</style>
